package com.hzc.springchan.controller;

import com.hzc.springchan.annotation.CApi;
import com.hzc.springchan.annotation.CParam;
import com.hzc.springchan.annotation.CParams;
import com.hzc.springchan.bean.request.Request;
import com.hzc.springchan.bean.response.Response;
import com.hzc.springchan.enums.CParamCheck;
import com.hzc.springchan.enums.CResource;
import com.hzc.springchan.service.IRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: 通用模块控制器类
 * @Author: chen990627
 * @Date: 2022/11/01
 **/
@CrossOrigin
@RestController
@RequestMapping("/common")
public class CommonController extends BaseController {

    @Autowired
    private IRouteService routeService;

    /**
     * 发送短信验证码
     *
     * @param request
     * @return
     */
    @PostMapping("/send_code")
    @CApi(skipTokenCheck = true, resource = CResource.SEND_CODE)
    @CParams({
            @CParam(params = {"userName", "business"}, values = CParamCheck.NULL_CHECK)
    })
    public Response sendCode(@RequestBody Request request) {
        return requestRoute(routeService);
    }
}
